package com.asiainfo.util;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import com.asiainfo.bean.UserSessionBean;


public class SessionInfoUtil {
	
	//private static final String SESSION_NAME = "UserSessBean";
	  private static Map<String, String> sessionMap = new HashMap();

	  public static void setUserSessBean(HttpSession oSession, UserSessionBean userSessBean)
	  {
	    oSession.setAttribute("UserSessBean", userSessBean);
	  }

	  public static UserSessionBean getUserSessBean(HttpSession oSession)
	  {
	    UserSessionBean userSessBean = (UserSessionBean)oSession.getAttribute("UserSessBean");
	    return userSessBean;
	  }

	  public static void removeUserSessBean(HttpSession oSession)
	  {
	    oSession.removeAttribute("UserSessBean");
	  }

	  public static boolean isUserSession(String sessionName)
	  {
	    return sessionName.equals("UserSessBean");
	  }

	  public static void putUserSession(String sessionId, String userID)
	  {
	    sessionMap.put(sessionId, userID);
	  }

	  public static String removeUserSession(String sessionId)
	  {
	    return (String)sessionMap.remove(sessionId);
	  }

	  public static int getSessionCount()
	  {
	    return sessionMap.size();
	  }
	
}
